# Contributor: wener <wenermail@gmail.com>
# Maintainer: wener <wenermail@gmail.com>
pkgname=grpc-java
pkgver=1.52.1
pkgrel=0
pkgdesc="The Java gRPC implementation. HTTP/2 based RPC"
url="https://github.com/grpc/grpc-java"
# armhf blocked by build failures
# riscv64 blocked by java
#arch="all !armhf !armv7 !s390x !riscv64 !ppc64le"
license="Apache-2.0"
depends="java-jre-headless"
makedepends="java-jdk protobuf-dev nss"
source="$pkgname-$pkgver.tar.gz::https://github.com/grpc/grpc-java/archive/v$pkgver.tar.gz
	01-compiler.patch
	"
options="!check"

build() {
	export GRADLE_USER_HOME="$srcdir"/.gradle
	cd compiler
	# support Java 16
	../gradlew --no-daemon --parallel --info java_pluginExecutable -PskipAndroid=true
}

package() {
	install -D -m 755 compiler/build/exe/java_plugin/protoc-gen-grpc-java "$pkgdir"/usr/bin/protoc-gen-grpc-java
}

sha512sums="
c6618c864dea0d8a27c48490343ad1cf0ec3b6c51698474744d74d6004eb88e3d63480b3c6e05e9a3f56ab2a373c84c0c66552ed27c86c37710d66755f366da2  grpc-java-1.52.1.tar.gz
533c2318a4f1ab38c3b5d39179aec7111a7e4285bc64047c0653e5eac7370c8a12f6941ebe724876e54cf3acba1e82d2360c6fcd2f3b0ab6f7c2e56df92aae69  01-compiler.patch
"
